//
//  NSObject+Extension.swift
//  EmoticonKeyboard
//
//  Created by 陈锦聪 on 16/4/2.
//  Copyright © 2016年 Coco. All rights reserved.
//

import Foundation

extension NSObject {
    
    /// 获取类的所有属性
    class func getIvarList() {
        
        var count: UInt32 = 0
        let ivars = class_copyIvarList(self, &count)
        for i in 0..<count {
            let ivar = ivars[Int(i)]
            let cName = ivar_getName(ivar)
            if let name = String(CString: cName, encoding: NSUTF8StringEncoding) {
                print("\(self).@property(\(i)): <\(name)>")
            }
        }
        free(ivars)
    }
}